<template>
    <div class="n-1-enterpriseDetails-content" >
        
        <!-- 企业详细信息 -->
         <div class="top-navigation-bar">
            <div
             class="navigation-item-box" 
             v-for="(item,index) in topNavigationBar" :key="index" 
             :class="currentSelectData.title == item.title?'select-item-box':''"
             @click="selectChange(item)"
            >
                <span class="navigation-icon" :class="'iconfont '+item.icon"></span>
                <span class="navigation-title">{{ item.title }}</span>
            </div>
         </div>
         <div class="navigation-content-box">
            <div v-if="currentSelectData.title == '企业信息'" class="enterprise-information-box" >
                <div class="enterprise-info-left">
                    <div
                     class="info-left-item" v-for="(item,index) in enterpriseInfoLeftList" :key="index" 
                     :class="currentEnterInfoData.title == item.title?'select-enterInfoItem-box':''"
                     @click="selectEnterpriseInfoLeftClick(item)"
                    >
                        <span class="info-left-icon" :class="'iconfont '+item.icon" ></span>
                        <span class="info-left-text" >{{ item.title }}</span>
                    </div>
                </div>
                <div class="enterprise-info-right"  >
                    <div v-if="currentEnterInfoData.title == '基础信息'">
                        <div class="table-box-v">
                            <table border bordercolor="#d9d9d9" style="width: 100%;">
                                <tr>
                                    <td class="title-left-v">企业名称</td>
                                    <td>{{ currentEnterpriseFrom.fqymc?currentEnterpriseFrom.fqymc:'无' }}</td>
                                    <td class="title-left-v">统一社会信用代码</td>
                                    <td>{{ currentEnterpriseFrom.ftyshxydm?currentEnterpriseFrom.ftyshxydm:'无' }}</td>
                                </tr>
                                <tr>
                                    <td class="title-left-v">注册号</td>
                                    <td>{{ currentEnterpriseFrom.fzch?currentEnterpriseFrom.fzch:'无' }}</td>
                                    <td class="title-left-v">法定代表人</td>
                                    <td>{{ currentEnterpriseFrom.fqyfddbrfzr?currentEnterpriseFrom.fqyfddbrfzr:'无' }}</td>
                                </tr>
                                <tr>
                                    <td class="title-left-v">企业性质</td>
                                    <td>{{ currentEnterpriseFrom.fqyxz?currentEnterpriseFrom.fqyxz:'无' }}</td>
                                    <td class="title-left-v">成立日期</td>
                                    <td>{{ currentEnterpriseFrom.fclrq?currentEnterpriseFrom.fclrq:'无' }}</td>
                                </tr>
                                <tr>
                                    <td class="title-left-v">联系人</td>
                                    <td>{{ currentEnterpriseFrom.fqylxr?currentEnterpriseFrom.fqylxr:'无' }}</td>
                                    <td class="title-left-v">联系电话</td>
                                    <td>{{ currentEnterpriseFrom.fqylxrdh?currentEnterpriseFrom.fqylxrdh:'无' }}</td>
                                </tr>
                                <tr>
                                    <td class="title-left-v">登记机关</td>
                                    <td>{{ currentEnterpriseFrom.fdjjg?currentEnterpriseFrom.fdjjg:'无' }}</td>
                                    <td class="title-left-v">登记状态</td>
                                    <td>{{ currentEnterpriseFrom.fdjzt?currentEnterpriseFrom.fdjzt:'无' }}</td>
                                </tr>
                                <tr>
                                    <td class="title-left-v">住所</td>
                                    <td colspan="3">{{ currentEnterpriseFrom.fqyzszcdz?currentEnterpriseFrom.fqyzszcdz:'无' }}</td>
                                </tr>
                                <tr>
                                    <td class="title-left-v">经营范围(营业执照)</td>
                                    <td colspan="3">{{ currentEnterpriseFrom.fxkfw?currentEnterpriseFrom.fxkfw:'无' }}</td>
                                </tr>
                                <tr>
                                    <td class="title-left-v">注册资本</td>
                                    <td>{{ currentEnterpriseFrom.fzczb?currentEnterpriseFrom.fzczb:'无' }}</td>
                                    <td class="title-left-v">职工人数</td>
                                    <td>{{ currentEnterpriseFrom.fzgrs?currentEnterpriseFrom.fzgrs:'无' }}</td>
                                </tr>
                                
                            </table>
                            
                        </div>
                    </div>
                    <div v-if="currentEnterInfoData.title == '证件信息'">
                        <commpVxeTable
                            :key="refreshTable"
                            ref="headmanVxeTable"
                            :config="{
                                api:assessCheckApi.xzxkqyqueryQyzj,
                                rowId: 'id',
                                height:windowInnerHeight - 220,
                                autoHidden:true,
                                paramet:{
                                    fqyid:currentEnterpriseFrom.id,
                                    tyshxydm:currentEnterpriseFrom.ftyshxydm
                                }
                            }" 
                            :columns="documentColumnsVxe" 
                            :formItem="documentFormItem"
                            :adaptiveHeight="true"
                            tablePadding="0"
                            :conditionBtnRow="true"
                            :isCanWrap="true"
                        >
                            <template v-slot:sfyx_name="{row}" >
                                <span v-if="row.sfyx == 1" style="color:#91cc75">有效</span>
                                <span v-else style="color: #ee6666;">无效</span>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item v-if="row.zjmc == '药品生产许可证'">
                                        <a-button class="blue-btn" type="primary" @click="detailsClick(row)" >详情</a-button>
                                    </a-form-item>
                                </a-form> 
                            </template>
                        </commpVxeTable>
                        <enterDetails ref="enterDetailsRef" />
                    </div>
                    <div v-if="currentEnterInfoData.title == '企业产值'">
                        <commpVxeTable
                            :key="refreshTable"
                            ref="headmanVxeTable"
                            :config="{
                                api:assessCheckApi.spcyQyInfogetCzPage,
                                rowId: 'id',
                                height:windowInnerHeight - 330,
                                paramet:{
                                    fqyid:currentEnterpriseFrom.id,
                                    tyshxydm:currentEnterpriseFrom.ftyshxydm
                                }
                            }" 
                            :columns="outputValueVxe" 
                            :formItem="outputValueFormItem"
                            tablePadding="0"
                            :conditionBtnRow="true"
                            :isCanWrap="true"
                        >
                            <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                                <vxe-form-item>
                                    <template>
                                        <a-button class="blue-btn" type="primary" @click="addClick(5)">新增</a-button>
                                    </template>
                                </vxe-form-item>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,5)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item v-else>
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,5,'查看')" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="red-btn" type="primary" @click="deleteClick(row,5)" >删除</a-button>
                                    </a-form-item>
                                </a-form> 
                            </template>
                        </commpVxeTable>
                        <addEdit5 ref="addEditRef5" @addItem="addItem" @editItem="editItem"/>
                    </div>
                    <div v-if="currentEnterInfoData.title == '研发投入'">
                        <commpVxeTable
                            :key="refreshTable"
                            ref="headmanVxeTable"
                            :config="{
                                api:assessCheckApi.spcyQyInfogetYftrPage,
                                rowId: 'id',
                                height:windowInnerHeight - 330,
                                paramet:{
                                    fqyid:currentEnterpriseFrom.id,
                                    tyshxydm:currentEnterpriseFrom.ftyshxydm
                                }
                            }" 
                            :columns="RDInvestmentColumnsVxe" 
                            :formItem="outputValueFormItem"
                            tablePadding="0"
                            :conditionBtnRow="true"
                            :isCanWrap="true"
                        >
                            <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                                <vxe-form-item>
                                    <template>
                                        <a-button class="blue-btn" type="primary" @click="addClick(6)">新增</a-button>
                                    </template>
                                </vxe-form-item>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,6)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item v-else>
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,6,'查看')" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="red-btn" type="primary" @click="deleteClick(row,6)" >删除</a-button>
                                    </a-form-item>
                                </a-form> 
                            </template>
                        </commpVxeTable>
                        <addEdit6 ref="addEditRef6" @addItem="addItem" @editItem="editItem"/>
                    </div>
                    <div v-if="currentEnterInfoData.title == '人员信息'">
                        <div class="personnel-class-top-v">
                            <div class="personnel-class-title">
                                <span class="vertical-line"></span>
                                <span class="title" >企业关键人员</span>
                            </div>
                            <div v-if="KeyPersonnelShow" @click="KeyPersonnelShow = !KeyPersonnelShow" class="hide-display-box">隐藏列表<a-icon type="up" style="padding-top: 1px;padding-left: 3px;"/></div>
                            <div v-if="!KeyPersonnelShow" @click="KeyPersonnelShow = !KeyPersonnelShow" class="hide-display-box">显示列表<a-icon type="down" style="padding-top: 1px;padding-left: 3px;"/></div>
                        </div>
                        <div v-if="KeyPersonnelShow">
                            <commpVxeTable
                                :key="KeyPersonnelreshTable"
                                ref="headmanVxeTable"
                                :config="{
                                    api:assessCheckApi.xzxkqyqueryQyRyxx,
                                    rowId: 'id',
                                    height:windowInnerHeight - 220,
                                    autoHidden:true,
                                    paramet:{
                                        fqyid:currentEnterpriseFrom.id,
                                        tyshxydm:currentEnterpriseFrom.ftyshxydm
                                    }
                                }" 
                                :columns="personnelInfoColumnsVxe" 
                                :formItem="[]"
                                :adaptiveHeight="true"
                                tablePadding="0"
                                :conditionBtnRow="true"
                                :isCanWrap="true"
                            > 
                                <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                                    <vxe-form-item>
                                        <template>
                                            <a-button class="blue-btn" type="primary" @click="personnelExportClick('关键人员')">导出</a-button>
                                        </template>
                                    </vxe-form-item>
                                </template>
                                <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                    <a-form layout="inline" class="search-form" >
                                        <a-form-item v-if="row.zjmc == '药品生产许可证'">
                                            <a-button class="blue-btn" type="primary" @click="detailsClick(row)" >详情</a-button>
                                        </a-form-item>
                                    </a-form> 
                                </template>
                            </commpVxeTable>
                        </div>
                        <div class="personnel-class-top-v" style="margin-top: 10px;" >
                            <div class="personnel-class-title">
                                <span class="vertical-line"></span>
                                <span class="title" >企业其他人员</span>
                            </div>
                            <div v-if="othersPersonnelShow" @click="othersPersonnelShow = !othersPersonnelShow" class="hide-display-box">隐藏列表<a-icon type="up" style="padding-top: 1px;padding-left: 3px;"/></div>
                            <div v-if="!othersPersonnelShow" @click="othersPersonnelShow = !othersPersonnelShow" class="hide-display-box">显示列表<a-icon type="down" style="padding-top: 1px;padding-left: 3px;"/></div>
                        </div>
                        <div v-if="othersPersonnelShow">
                            <commpVxeTable
                                :key="refreshTable"
                                ref="headmanVxeTable"
                                :config="{
                                    api:assessCheckApi.xzxkqyqueryQyQtRy,
                                    rowId: 'id',
                                    autoHidden:true,
                                    paramet:{
                                        fqyid:currentEnterpriseFrom.id,
                                        tyshxydm:currentEnterpriseFrom.ftyshxydm
                                    }
                                }" 
                                :columns="othersPersonnelColumnsVxe" 
                                :formItem="othersPersonnelFormItem"
                                tablePadding="0"
                                :conditionBtnRow="true"
                                :adaptiveHeight="true"
                                :isCanWrap="true"
                            >
                                <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                                    <vxe-form-item>
                                        <template>
                                            <a-button class="blue-btn" type="primary" @click="addClick(7)">新增</a-button>
                                        </template>
                                    </vxe-form-item>
                                    <vxe-form-item>
                                        <template>
                                            <a-button class="blue-btn" type="primary" @click="personnelExportClick('其他人员')">导出</a-button>
                                        </template>
                                    </vxe-form-item>
                                    <vxe-form-item>
                                        <template>
                                            <a-upload style="display: inline-block;" :beforeUpload="$event=>{return false}" action="" @change="leadingInClick">
                                                <a-button class="blue-btn" type="default"  icon="import">导入</a-button>
                                            </a-upload>
                                        </template>
                                    </vxe-form-item>
                                </template>
                                <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                    <a-form layout="inline" class="search-form" >
                                        <a-form-item v-if="!isDisabled">
                                            <a-button class="blue-btn" type="primary" @click="editClick(row,7)" >编辑</a-button>
                                        </a-form-item>
                                        <a-form-item v-else>
                                            <a-button class="blue-btn" type="primary" @click="editClick(row,7,'查看')" >查看</a-button>
                                        </a-form-item>
                                        <a-form-item v-if="!isDisabled">
                                            <a-button class="red-btn" type="primary" @click="deleteClick(row,7)" >删除</a-button>
                                        </a-form-item>
                                    </a-form> 
                                </template>
                            </commpVxeTable>
                            <addEdit7 ref="addEditRef7" @addItem="addItem" @editItem="editItem"/>
                        </div>
                    </div>
                    <div v-if="currentEnterInfoData.title == '生产设备'">
                        <commpVxeTable
                            :key="refreshTable"
                            ref="headmanVxeTable"
                            :config="{
                                api:assessCheckApi.spcyQyInfoqueryQySbxxPageList,
                                rowId: 'id',
                                paramet:{
                                    fqyid:currentEnterpriseFrom.id,
                                    fsblx:'生产设备'
                                }
                            }" 
                            :columns="deviceInfoColumnsVxe" 
                            :formItem="deviceInfoFormItem"
                            :isCanWrap="true"
                            :conditionBtnRow="true"
                            :occupancyHeight="110"
                        > 
                            <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                                <vxe-form-item>
                                    <template>
                                        <a-button class="blue-btn" type="primary" @click="addClick(11,{fsblx:'生产设备'})">新增</a-button>
                                    </template>
                                </vxe-form-item>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="blue-btn" type="primary" @click="editClick({...row,fsblx:'生产设备'},11)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item v-else>
                                        <a-button class="blue-btn" type="primary" @click="editClick({...row,fsblx:'生产设备'},11,'查看')" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="red-btn" type="primary" @click="deleteClick({...row,fsblx:'生产设备'},11)" >删除</a-button>
                                    </a-form-item>
                                </a-form> 
                            </template>
                        </commpVxeTable>
                        <!-- 设备新增编辑 -->
                        <addEdit11 ref="addEditRef11" @addItem="addItem" @editItem="editItem"/>
                    </div>
                    <div v-if="currentEnterInfoData.title == '检验设备'" >
                        <commpVxeTable
                            :key="refreshTable"
                            ref="headmanVxeTable"
                            :config="{
                                api:assessCheckApi.spcyQyInfoqueryQySbxxPageList,
                                rowId: 'id',
                                paramet:{
                                    fqyid:currentEnterpriseFrom.id,
                                    fsblx:'检验设备'
                                }
                            }" 
                            :columns="deviceInfoColumnsVxe2" 
                            :formItem="deviceInfoFormItem"
                            :isCanWrap="true"
                            :conditionBtnRow="true"
                            :occupancyHeight="110"
                        > 
                            <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                                <vxe-form-item>
                                    <template>
                                        <a-button class="blue-btn" type="primary" @click="addClick(11,{fsblx:'检验设备'})">新增</a-button>
                                    </template>
                                </vxe-form-item>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="blue-btn" type="primary" @click="editClick({...row,fsblx:'检验设备'},11)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item v-else>
                                        <a-button class="blue-btn" type="primary" @click="editClick({...row,fsblx:'检验设备'},11,'查看')" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="red-btn" type="primary" @click="deleteClick({...row,fsblx:'检验设备'},11)" >删除</a-button>
                                    </a-form-item>
                                </a-form> 
                            </template>
                        </commpVxeTable>
                        <addEdit11 ref="addEditRef11" @addItem="addItem" @editItem="editItem"/>
                    </div>
                    <div v-if="currentEnterInfoData.title == '供应商'">
                        <commpVxeTable
                            :key="refreshTable"
                            ref="headmanVxeTable"
                            :config="{
                                api:assessCheckApi.spcyQyInfoQueryYlgyssjPageList,
                                rowId: 'id',
                                height:windowInnerHeight - 220,
                                autoHidden:true,
                                paramet:{
                                    fqyid:currentEnterpriseFrom.id
                                }
                            }" 
                            :columns="rawMaterialColumnsVxe" 
                            :formItem="[{
                                label: '供应商名称',
                                model: 'fscsmc',
                            }]"
                            :adaptiveHeight="true"
                            tablePadding="0"
                            :conditionBtnRow="true"
                        > 
                            <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                                <vxe-form-item>
                                    <template>
                                        <a-button class="blue-btn" type="primary" @click="addClick(4)">新增</a-button>
                                    </template>
                                </vxe-form-item>
                            </template>
                            <template v-slot:sfgq_name="{row}">
                                <span v-if="row.sfgq == '长期有效'" style="color: #91cc75;">长期有效</span>
                                <span v-if="row.sfgq == '未过期'" style="color: #5470c6;">未过期</span>
                                <span v-if="row.sfgq == '即将过期'" style="color: #fac858;">即将过期</span>
                                <span v-if="row.sfgq == '已过期'" style="color: #ee6666;">已过期</span>
                            </template>
                            <template v-slot:operation_btn="{row}" data-desc="自定操作栏">
                                <a-form layout="inline" class="search-form" >
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,4)" >编辑</a-button>
                                    </a-form-item>
                                    <a-form-item v-else>
                                        <a-button class="blue-btn" type="primary" @click="editClick(row,4,'查看')" >查看</a-button>
                                    </a-form-item>
                                    <a-form-item v-if="!isDisabled">
                                        <a-button class="red-btn" type="primary" @click="deleteClick(row,4)" >删除</a-button>
                                    </a-form-item>
                                </a-form> 
                            </template>
                        </commpVxeTable>
                        <!-- 供应商新增编辑 -->
                        <addEdit4 ref="addEditRef4" @addItem="addItem" @editItem="editItem"/>
                    </div>
                    <!-- xzxkqyqueryQyRyxx -->
                    <div v-if="currentEnterInfoData.title == '物料管理'">
                        <materialManage ref="materialManageRef" />
                    </div>
                </div>
            </div>
            <div v-if="currentSelectData.title == '品种信息'" class="enterprise-information-box">
                <commpVxeTable
                    :key="refreshTable"
                    ref="headmanVxeTable"
                    :config="{
                        api:assessCheckApi.spcyQyInfoQueryPzjbxxPageList,
                        rowId: 'id',
                        height:windowInnerHeight - 220,
                        autoHidden:true,
                        paramet:{
                            fqyid:currentEnterpriseFrom.id
                        }
                    }" 
                    :columns="breedColumnsVxe" 
                    :formItem="[]"
                    :isCanWrap="true"
                    :adaptiveHeight="true"
                > 
                    <template v-slot:externalOperations="{data}" v-if="!isDisabled">
                        <vxe-form-item>
                            <template>
                                <a-button class="blue-btn" type="primary" @click="addClick(2)">新增</a-button>
                            </template>
                        </vxe-form-item>
                    </template>
                    <template v-slot:operation_btn="{row}" data-desc="自定操作栏" >
                        <a-form layout="inline" class="search-form">
                            <a-form-item v-if="!isDisabled">
                                <a-button class="blue-btn" type="primary" @click="editClick(row,2)" >编辑</a-button>
                            </a-form-item>
                            <a-form-item v-else>
                                <a-button class="blue-btn" type="primary" @click="editClick(row,2,'查看')" >查看</a-button>
                            </a-form-item>
                            <a-form-item v-if="!isDisabled">
                                <a-button class="red-btn" type="primary" @click="deleteClick(row,2)" >删除</a-button>
                            </a-form-item>
                        </a-form> 
                    </template>
                </commpVxeTable>
                <!-- 品种信息新增编辑 -->
                <addEdit2 ref="addEditRef2" @addItem="addItem" @editItem="editItem"/>
            </div>
            <div v-if="currentSelectData.title == '审评信息'" class="enterprise-information-box">
                <commpVxeTable
                    :key="refreshTable"
                    ref="headmanVxeTable"
                    :config="{
                        api:assessCheckApi.xzxkqyqueryQyRcjc,
                        rowId: 'id',
                        height:windowInnerHeight - 220,
                        autoHidden:true,
                        paramet:{
                            fqyid:currentEnterpriseFrom.id,
                            tyshxydm:currentEnterpriseFrom.ftyshxydm
                        }
                    }" 
                    :columns="inspectColumnsVxe" 
                    :formItem="[]"
                    :isCanWrap="true"
                    :adaptiveHeight="true"
                > 
                    <template v-slot:operation_btn="{row}" data-desc="自定操作栏" >
                        <a-form layout="inline" class="search-form">
                            <a-form-item v-if="!isDisabled">
                                <a-button class="blue-btn" type="primary" @click="editClick(row,2)" >编辑</a-button>
                            </a-form-item>
                            <a-form-item v-else>
                                <a-button class="blue-btn" type="primary" @click="editClick(row,2,'查看')" >查看</a-button>
                            </a-form-item>
                            <a-form-item v-if="!isDisabled">
                                <a-button class="red-btn" type="primary" @click="deleteClick(row,2)" >删除</a-button>
                            </a-form-item>
                        </a-form> 
                    </template>
                </commpVxeTable>
            </div>
         </div>
    </div>
</template>
<script>
import { 
    spcyQyInfoqueryQyJbxxById,
    spcyQyInfoDeleteYlgyssj,
    spcyQyInfoUpdateYlgyssj,
    spcyQyInfoAddYlgyssj,
    spcyQyInfodeleteQySbxx,
    spcyQyInfosaveQySbxx,
    spcyQyInfoDeletePzjbxx,
    spcyQyInfoUpdatePzjbxx,
    spcyQyInfoAddPzjbxx,
    spcyQyInfoaddQyCz,
    spcyQyInfoupdateQyCz,
    spcyQyInfodeleteQyCz,
    spcyQyInfoaddQyYftr,
    spcyQyInfoupdateQyYftr,
    spcyQyInfodeleteQyYftr,
    xzxkqyaddQyQtry,
    xzxkqyupdateQyQtry,
    xzxkqydeleteQyQtry,
    xzxkqyexportQyRyxx,
    xzxkqyexportQyQtRy,
    xzxkqyimportQyQtRy,
 } from './service/index'
import assessCheckApi from './service/api'
import commpVxeTable from '@/components/commp-vxe-table/commp-vxe-table.vue'
import materialManage from './materialManage/materialManage.vue'
import addEdit2 from './addEdit2.vue'
import addEdit4 from './addEdit4.vue'
import addEdit11 from './addEdit11.vue'
import enterDetails from './enterDetails.vue'
import addEdit5 from './addEdit5.vue'
import addEdit6 from './addEdit6.vue'
import addEdit7 from './addEdit7.vue'
export default {
    components:{
        commpVxeTable,
        materialManage,
        addEdit2,
        addEdit4,
        addEdit11,
        enterDetails,
        addEdit5,
        addEdit6,
        addEdit7,
    },
    props:{

    },
    data(){
        return{
            assessCheckApi,
            windowInnerHeight:window.innerHeight,
            topNavigationBar:[{
                title:'企业信息',
                icon:'spcy-icon-qiyexinxi1',
                ycIcon:'',
            },{
                title:'品种信息',
                icon:'spcy-icon-pinzhong',
                ycIcon:'',
            },{
                title:'审评信息',
                icon:'spcy-icon-chayan',
                ycIcon:'',
            },{
                title:'抽检信息',
                icon:'spcy-icon-choujianguanli',
                ycIcon:'',
            }],
            currentSelectData:{
                title:'企业信息',
                icon:'spcy-icon-qiyexinxi1',
                ycIcon:'',
            },
            enterpriseInfoLeftList:[{//企业信息
                title:'基础信息',
                icon:'spcy-icon-jichuxinxi',
            },{
                title:'证件信息',
                icon:'spcy-icon-zhengqimenhu_zhengjianxinxi',
            },{
                title:'企业产值',
                icon:'spcy-icon-zhengqimenhu_zhengjianxinxi',
            },{
                title:'研发投入',
                icon:'spcy-icon-zhengqimenhu_zhengjianxinxi',
            },{
                title:'人员信息',
                icon:'spcy-icon-renyuanxinxi',
            },{
                title:'生产设备',
                icon:'spcy-icon-tubiaozhizuomoban-',
            },{
                title:'检验设备',
                icon:'spcy-icon-jianyanshebei',
            },{
                title:'供应商',
                icon:'spcy-icon-gongyingshang',
            }
            // ,{
            //     title:'物料管理',
            //     icon:'spcy-icon-wuliaoguanli',
            // }
            ],
            
            currentEnterInfoData:{
                title:'基础信息',
                icon:'spcy-icon-jichuxinxi',
            },
            currentEnterpriseFrom:{},
            commentPassData:{},
            deviceInfoFormItem:[{
                label: '关键字查询',
                model: 'gjz',
            }],
            deviceInfoColumnsVxe:[{ //设备
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },{
                title: '设备名称', 
                field: 'fccbh',
            },{
                title: '设备编号', 
                field: 'fccbh',
            },{
                title: '设备型号', 
                field: 'fsbxh',
            },{
                title: '生产厂家', 
                field: 'fycd',
            },{
                title: '对应品种', 
                field: 'fsbyt',
            },{
                title: '对应车间', 
                field: 'fdycj',
            },{
                title: '生产线', 
                field: 'fscx',
            },{
                title: '关键技术参数', 
                field: 'fsbjd',
            },{
                title: '生产能力或产量范围', 
                field: 'fjcfw',
            },{
                title: '检定或校准情况', 
                field: 'fjdhjzqk',
            },{
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:145,
                    fixed:'right'
            }],
            deviceInfoColumnsVxe2:[{ //设备
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },{
                title: '设备名称', 
                field: 'fsbmc',
            },{
                title: '设备编号', 
                field: 'fccbh',
            },{
                title: '设备型号', 
                field: 'fsbxh',
            },{
                title: '生产厂家', 
                field: 'fycd',
            },{
                title: '对应品种', 
                field: 'fsbyt',
            },{
                title: '对应场所', 
                field: 'fdycj',
            },{
                title: '关键技术参数', 
                field: 'fsbjd',
            },{
                title: '检定或校准情况', 
                field: 'fjdhjzqk',
            },{
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:145,
                    fixed:'right'
            }],
            rawMaterialColumnsVxe:[{ //供应商
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },
            // {
            //     title: '物料目录', 
            //     field: 'fwlfl',
            // },{
            //     title: '经销商名称', 
            //     field: 'fjxsmc',
            // },
            // {
            //     title: '质量标准', 
            //     field: 'fzlbz',
            // },
            {
                title: '供应商类别', 
                field: 'fgyslb',
            },{
                title: '供应商名称', 
                field: 'fscsmc',//暂用生产商名称
            },
            // {
            //     title: '生产商地址', 
            //     field: 'fscsdz',
            // },
            {
                title: '供应商地址', 
                field: 'fgysdz',
            },{
                title: '审计有效期', 
                field: 'fwlyxq',
            },{
                title: '是否过期', 
                field: 'sfgq',
                slots: {
                    default: 'sfgq_name',
                },
                
            },{
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:145,
                    fixed:'right'
            }],
            breedColumnsVxe:[{ //品种
                type: 'checkbox', 
                width: 60 ,
                fixed: 'left'
            },{
                title: '通用名称', 
                field: 'ftymc',
            },{
                title: '商品名', 
                field: 'fspm',
            },{
                title: '执行标准', 
                field: 'fzxbz',
            },{
                title: '药品有效期', 
                field: 'fypyxq',
            },{
                title: '药品分类', 
                field: 'fcplb',
            },{
                title: '处方', 
                field: 'fcf',
            },{
                title: '剂型', 
                field: 'fjx',
            },{
                title: '规格', 
                field: 'fgg',
            },{
                title: '批准文号', 
                field: 'fpzwh',
            },{
                title: '批准文号有限期', 
                field: 'fpzwhyxq',
            },{
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:210,
                    fixed:'right'
            }],
            documentFormItem:[{
                label: '证件名称',
                model: 'zjmc',
                // type:'Select',
                // options:[{
                //     label:'有效',
                //     value:'1'
                // },{
                //     label:'无效',
                //     value:'0'
                // }]
            }],
            documentColumnsVxe:[{//证件信息
                title: '证件名称', 
                field: 'zjmc',
            },{
                title: '证件编号', 
                field: 'zjbh',
            },{
                title: '地址', 
                field: 'zs',
            },{
                title: '发证部门', 
                field: 'fzjg',
            },{
                title: '发证日期', 
                field: 'fzrq',
            },{
                title: '证书期限', 
                field: 'yxqx',
            },{
                title: '是否有效', 
                field: 'sfyx',
                slots: {
                    // 使用插槽模板渲染
                    default: 'sfyx_name',
                },
                
            },
            // {
            //     title: '有效期限', 
            //     field: 'yxqx',
            // },
            {
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:72,
                    fixed:'right'
            }],
            outputValueFormItem:[{
                label: '年份',
                model: 'fnf',
                interval:true,
                type:'datePicker',
                format:'YYYY',
            }],
            outputValueVxe:[{//企业产值
                title: '年份', 
                field: 'fnf',
            },{
                title: '总产值（万元）', 
                field: 'fzcz',
            },{
                title: '营业税金（万元）', 
                field: 'fyysj',
            },{
                title: '年度新增产品产值（万元）', 
                field: 'fndxzcpcz',
            },{
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:145,
                    fixed:'right'
            }],
            RDInvestmentColumnsVxe:[{
                title: '年份', 
                field: 'fnf',
            },{
                title: '在研产品数量', 
                field: 'fzycpsl',
            },{
                title: '研究投入成本（万元）', 
                field: 'fyjtrcb',
            },{
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:145,
                    fixed:'right'
            }],
            personnelInfoColumnsVxe:[{
                title: '人员类型', 
                field: 'ryfl',
            },{
                title: '姓名', 
                field: 'xm',
            },{
                title: '职务', 
                field: 'zw',
            },{
                title: '学历', 
                field: 'xl',
            },{
                title: '专业', 
                field: 'zy',
            },{
                title: '职称', 
                field: 'jszz',
            },{
                title: '身份证件类型', 
                field: 'zjlx',
            },{
                title: '证件号码', 
                field: 'zjhm',
            },{
                title: '部门', 
                field: 'bm',
            },{
                title: '从事年限', 
                field: 'csnx',
            },{
                title: '联系手机', 
                field: 'sj',
            }],
            othersPersonnelFormItem:[{
                label: '姓名',
                model: 'zjmc',
            }],
            othersPersonnelColumnsVxe:[{
                title: '人员类型', 
                field: 'frylx',
            },{
                title: '姓名', 
                field: 'fgjry',
            },{
                title: '职务', 
                field: 'fzw',
            },{
                title: '学历', 
                field: 'fxl',
            },{
                title: '专业', 
                field: 'fzy',
            },{
                title: '职称', 
                field: 'fzc',
            },{
                title: '身份证件类型', 
                field: 'fzjlx',
            },{
                title: '证件号码', 
                field: 'fsfzh',
            },{
                title: '部门', 
                field: 'fbm',
            },{
                title: '从事年限', 
                field: 'fcsnx',
            },{
                title: '联系手机', 
                field: 'flxdh',
            },{
                    title: '操作',
                    field: 'id',
                    slots: {
                        // 使用插槽模板渲染
                        default: 'operation_btn',
                    },
                    width:145,
                    fixed:'right'
            }],
            inspectColumnsVxe:[{//检验信息
                title: '审评任务', 
                field: 'jcrw',
            },{
                title: '企业名称', 
                field: 'qymc',
            },{
                title: '审评类型', 
                field: 'jclx',
            },{
                title: '企业地址', 
                field: 'qydz',
            },{
                title: '执法单位', 
                field: 'zfdw',
            },{
                title: '审评结果', 
                field: 'jcjg',
            },{
                title: '审评日期', 
                field: 'jcrq',
            },],
            refreshTable:null,
            KeyPersonnelreshTable:null,
            isDisabled:false,
            methodList:[{
                index:0,
            },{index:1,},{
                name:'品种信息',
                deleteName:spcyQyInfoDeletePzjbxx,
                editName:spcyQyInfoUpdatePzjbxx,
                addName:spcyQyInfoAddPzjbxx,
            },{index:3},{
                name:'供应商',
                deleteName:spcyQyInfoDeleteYlgyssj,
                editName:spcyQyInfoUpdateYlgyssj,
                addName:spcyQyInfoAddYlgyssj,
            },{
                name:'企业产值',
                addName:spcyQyInfoaddQyCz,
                editName:spcyQyInfoupdateQyCz,
                deleteName:spcyQyInfodeleteQyCz,
            },{
                name:'研发投入',
                addName:spcyQyInfoaddQyYftr,
                editName:spcyQyInfoupdateQyYftr,
                deleteName:spcyQyInfodeleteQyYftr,
            },{
                name:'其他人员信息',
                addName:xzxkqyaddQyQtry,
                editName:xzxkqyupdateQyQtry,
                deleteName:xzxkqydeleteQyQtry,
            },{index:8},{index:9},{index:10},{
                name:'设备信息',
                deleteName:spcyQyInfodeleteQySbxx,
                editName:spcyQyInfosaveQySbxx,
                addName:spcyQyInfosaveQySbxx,
            }],
            KeyPersonnelShow:true,
            othersPersonnelShow:true,
        }
    },
    watch:{

    },
    created(){
        if(!this.commentPassData.fqyid){
            this.getEnterpriseDetails()
        }
    },
    methods:{
        getData(row,isDisabled){
            this.isDisabled = isDisabled
            this.commentPassData = row
            this.getEnterpriseDetails(row)
        },
        getEnterpriseDetails(row){//获取企业信息
            let data = {}
            if(row && row.fqyid){
                data = {
                    fqyid:row.fqyid
                }
            }
            spcyQyInfoqueryQyJbxxById({data}).then(res=>{
                if(res.code == 200){
                    //console.log('获取企业信息',res.result.qyxx )
                    this.currentEnterpriseFrom = res.result.qyxx?res.result.qyxx:{}
                }else{
                    this.currentEnterpriseFrom ={}
                }
            })
        },
        selectChange(item){
            this.currentSelectData = item
            this.refreshTable = Date.now()
        },
        selectEnterpriseInfoLeftClick(item){
            this.currentEnterInfoData = item
            if(item.title == '物料管理'){
                this.$nextTick(()=>{
                    this.$refs.materialManageRef.getData({...this.currentEnterpriseFrom,isDisabled:this.isDisabled})
                })
            }
            this.refreshTable = Date.now()
            if(item.title == '人员信息'){
                this.KeyPersonnelreshTable = Date.now()
            }
        },

        addClick(index,row){
            this.currentAddRefName = 'addEditRef'+index
            let refName = 'addEditRef'+index
            this.$refs[refName].getData({fqyid:this.currentEnterpriseFrom.id,index:index,...row})
            this.$refs[refName].visible = true
        },
        editClick(val,index,view){
            //console.log(val,index)
            let refName = 'addEditRef'+index
            this.$refs[refName].getData({fqyid:this.currentEnterpriseFrom.id,...val,index:index,view:view?true:false})
            this.$refs[refName].visible = true
        },
        addItem(val,vis,isTip){
            //console.log('新增',val)
            let refName = 'addEditRef'+val.index
            this.methodList[val.index].addName(val).then(res=>{
                if(res.code == 200){
                    this.refreshTable = Date.now()
                    if(!isTip){
                        this.$message.success(res.message)
                    }
                    
                    this.$refs[refName].getData({fqyid:this.currentEnterpriseFrom.id,...res.result,index:val.index})
                    this.$refs[refName].visible = vis
                    //console.log(res)
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        editItem(val,vis){
            //console.log('编辑',val)
            let refName = 'addEditRef'+val.index
            this.methodList[val.index].editName(val).then(res=>{
                if(res.code == 200){
                    this.refreshTable = Date.now()
                    this.$message.success(res.message)
                    this.$refs[refName].visible = vis
                }else{
                    this.$message.warning(res.message)
                }
            })
        },
        deleteClick(val,index){
            var that = this
            this.$confirm({
                title:'您确认要删除吗？',
                // icon: createVNode(ExclamationCircleOutlined),
                onOk() {
                    that.methodList[index].deleteName({ids:val.id}).then(res=>{
                        if(res.code == 200){
                            that.$message.success('删除成功')
                            that.refreshTable = Date.now()
                        }else{
                            that.$message.warning(res.message)
                        }
                    })
                },
                
            });
        },
        detailsClick(row){
            this.$refs.enterDetailsRef.getData(row)
            this.$refs.enterDetailsRef.visible = true
        },
        leadingInClick({file}){//导入
            var that = this
            if(typeof file.uid !== 'undefined') {
                if(file.name.indexOf(".xls") !== -1 || file.name.indexOf(".xlsx") !==-1) {
                    const fileData = new FormData();
                    fileData.append("file",file);
                    fileData.append("fqyid",this.currentEnterpriseFrom.id);
                    xzxkqyimportQyQtRy(fileData).then(res => {
                        that.refreshTable = Date.now()
                        that.$message.success('导入成功')
                    }).catch(error =>{
                        that.$message.success('导入失败')
                    })
                }else{
                    this.$message.warning('请导入表格')
                }

            }
        },
        personnelExportClick(val){//导出
            let that = this
            let fileName = ''
            let param = {
                fqyid:this.currentEnterpriseFrom.id,
                tyshxydm:this.currentEnterpriseFrom.ftyshxydm
            }
            if(val == '关键人员'){
                fileName = '关键人员列表'
                xzxkqyexportQyRyxx(param).then((data) => {
                    if (!data) {
                        that.$message.warning('文件下载失败')
                        return
                    }
                    if (typeof window.navigator.msSaveBlob !== 'undefined') {
                        window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
                    } else {
                        let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
                        let link = document.createElement('a')
                        link.style.display = 'none'
                        link.href = url
                        link.setAttribute('download', fileName + '.xls')
                        document.body.appendChild(link)
                        link.click()
                        document.body.removeChild(link) //下载完成移除元素
                        window.URL.revokeObjectURL(url) //释放掉blob对象
                    }
                })
            }else{
                fileName = '其他人员列表'
                xzxkqyexportQyQtRy(param).then((data) => {
                    if (!data) {
                        that.$message.warning('文件下载失败')
                        return
                    }
                    if (typeof window.navigator.msSaveBlob !== 'undefined') {
                        window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
                    } else {
                        let url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
                        let link = document.createElement('a')
                        link.style.display = 'none'
                        link.href = url
                        link.setAttribute('download', fileName + '.xls')
                        document.body.appendChild(link)
                        link.click()
                        document.body.removeChild(link) //下载完成移除元素
                        window.URL.revokeObjectURL(url) //释放掉blob对象
                    }
                })
            }
        },
    }
}
</script>
<style lang="less">
.n-1-enterpriseDetails-content{
    margin: 10px;
    .top-navigation-bar{
        width: 100%;
        display: flex;
        .navigation-item-box{
            cursor: pointer;
            flex: 1;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 16px 0;
            // background-color: #edeff3;
            // border: 1px solid #d9d9d9;
            border-top-left-radius: 28px;
            border-top-right-radius: 28px;
            .navigation-icon{
                font-size: 26px;
                margin-right: 5px;
            }
            .navigation-title{
                font-size: 26px;
                font-weight: 600;
            }
            color: #999;
        }
        .select-item-box{
            background-color: #e6f7ff;
            border: 1px solid #d9d9d9;
            border-bottom: none;
            // border-bottom: 4px solid #38f;
            color: #38f;
            
        }
    }
    .navigation-content-box{
        margin-top: -1px;
        height: calc(100vh - 202px);
        border: 1px solid #d9d9d9;
        overflow-y: auto;
        .enterprise-information-box{//企业信息
            display: flex;
            // padding: 8px;
            .enterprise-info-left{
                height: calc(100vh - 204px);
                overflow-y: auto;
                // border: 1px solid #d9d9d9;
                border-right: 1px solid #d9d9d9;
                min-width: 180px;
                max-width: 20%;
                padding: 8px 0;
                
                .info-left-item{
                    padding: 8px 10px;
                    display: flex;
                    align-items: center;
                    cursor: pointer;
                    .info-left-icon{
                        margin-right: 5px;
                        font-size: 18px;
                        color: #999;
                    }
                    .info-left-text{
                        font-size: 17px;
                        font-weight: 600;
                        color: #999;
                    }
                }
                .select-enterInfoItem-box{
                    background-color: #e6f7ff;
                    border-right: 5px solid #38f;
                    .info-left-icon,.info-left-text{
                        color: #242424 !important;
                    }
                }
            }
            .enterprise-info-right{
                height: calc(100vh - 204px);
                overflow-y: auto;
                flex: 1;
                // border: 1px solid #d9d9d9;
                // border-left: none;
                padding: 8px;
                .personnel-class-top-v{
                    display: flex;
                    align-items: center;
                    
                    .personnel-class-title{
                        height: 32px;
                        font-size: 20px;
                        font-weight: 600;
                        color: #242424;
                        position: relative;
                        margin-bottom: 5px;
                        width: 140px;
                        .vertical-line{
                            position: absolute;
                            background-image: linear-gradient(to right, rgb(15, 155, 255), rgba(15, 155, 255, 0), );
                            background-size: 100% 100% !important;
                            width: 125px;
                            height: 8px;
                            bottom: 0;
                            z-index: 0;
                        }
                        .title{
                            position: absolute;
                            z-index: 1;
                            bottom: -1px;
                        }
                    }
                    .hide-display-box{
                        color: #38f;
                        font-weight: 600;
                        display: flex;
                        align-items: center;
                    }
                }
                .table-box-v{
                    td{
                        padding: 5px;
                        height: 30px;
                    }
                    .title-left-v{
                        text-align: center;
                        width: 160px;
                        font-weight: 600;
                        font-size: 16px;
                        background-color:#e6f7ff;
                        font-family: simHei;
                        color: rgba(0, 0, 0, 0.85);
                        .production-tips-box{
                            color: #ed5565;
                            font-size: 14px;
                            line-height: 30px;
                            padding-right: 5px;
                        }
                    }
                }
                
            }
        }
    }
}
</style>